package com.eorchis.module.user.domain;

import com.eorchis.api.IUser;
import com.eorchis.core.basedao.entity.IBaseEntity;
import com.eorchis.core.springext.mvc.propertyeditor.CustomDateSerializer;
import com.eorchis.module.basedata.domain.BaseData;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "BASE_USER")
@JsonIgnoreProperties({ "hibernateLazyInitializer" })
public class User implements IBaseEntity, IUser {
	private static final long serialVersionUID = 1L;
	
	public final static int VIEW_YES = 1;

	public final static int VIEW_NO = 0;

	public final static String WRONG = "wrong";

	public final static String FAILURE = "failure";

	public final static String SUCCESS = "success";

	public final static int ACTIVE_ENABLED = 1;

	public final static int ACTIVE_DISABLED = 0;

	public final static int EXAM = 1;

	public final static int NOT_EXAM = 0;

	public final static int UNBURNED = 0;

	public final static int BURNED = 1;

	public final static int ADMIN = 1;

	public final static int NOT_ADMIN = 0;

	public final static int TEACHER = 1;

	public final static int NOT_TEACHER = 0;

	public final static int STUDENT = 1;

	public final static int NOT_STUDENT = 0;

	public final static int BUREAU_RESERVE = 1;

	public final static int NOT_BUREAU_RESERVE = 0;

	public final static int ZUGONG = 1;

	public final static int NOT_ZUGONG = 0;

	public final static int DANGWU = 1;

	public final static int NOT_DANGWU = 0;
	
	public final static int SEX_DEFAULT_VALUE = 1078;

	public final static int TONGZHAN = 1;

	public final static int NOT_TONGZHAN = 0;
	
	public final static int DEGREE_DEFAULT_VALUE =1191;

	public final static int UNMODIFIED = 0;

	public final static int MODIFIED = 1;

	public final static int CREATED = 2;

	public final static int DISCARD = 3;

	public final static int REUSE = 4;

	public final static int DELETED = 5;

	public final static int HIERARCHY_C = 0;

	public final static int HIERARCHY_J = 1;

	public final static int AVAILABILITY_YES = 1;
	public final static int AVAILABILITY_NO = 0;

	/**
	 * 市管干部 by RongLT at 2013-03-22
	 */
	public final static Integer IS_SHIGUAN = new Integer(1);
	
	/**
	 * 非市管干部 by RongLT at 2013-03-22
	 */
	public final static Integer IS_NOT_SHIGUAN = new Integer(0);
	
	public final static Integer IS_QUERY_SHIGUAN= new Integer(2);
	
	public final static String PASSWORD = "ODg4OA==";
	public final static String STUDENTLEVELCODE="-1";
    public final static int BOYSEXID=1078;

    //职级类型编码
    public final static String RANK_CODE_TYPE_ID=new String("1228");
    //民族类型编码
    public final static String FOLK_CODE_TYPE_ID=new String("1224");
    //性别类型编码
    public final static String SEX_CODE_TYPE_ID=new String("1220");
    
	/** @deprecated */
	public static final Integer HIERARCHY_CJ = new Integer(1);

	/** @deprecated */
	public static final Integer HIERARCHY_JJ = new Integer(2);

	/** @deprecated */
	public static final Integer IS_ZUGONG_Y = new Integer(1);

	/** @deprecated */
	public static final Integer IS_ZUGONG_N = new Integer(2);

	/** @deprecated */
	public static final Integer IS_EXAM_Y = new Integer(1);

	/** @deprecated */
	public static final Integer IS_EXAM_N = new Integer(2);

	/** @deprecated */
	public static final Integer IS_BUREAURESERVE_Y = new Integer(1);

	/** @deprecated */
	public static final Integer IS_BUREAURESERVE_N = new Integer(2);

	/** @deprecated */
	public static final Integer IS_SHIGUAN_Y = new Integer(1);

	/** @deprecated */
	public static final Integer IS_SHIGUAN_N = new Integer(2);

	/** @deprecated */
	public static final Integer IS_ACTIVE_Y = Integer.valueOf(1);

	/** @deprecated */
	public static final Integer IS_ACTIVE_N = Integer.valueOf(2);

	/** @deprecated */
	public static final Integer IS_AVAILABILITY_Y = new Integer(1);

	/** @deprecated */
	public static final Integer IS_AVAILABILITY_N = new Integer(2);

	/** @deprecated */
	public static final Integer IS_DANGWU_Y = new Integer(1);

	/** @deprecated */
	public static final Integer IS_DANGWU_N = new Integer(2);

	/** @deprecated */
	public static final Integer IS_TONGZHAN_Y = new Integer(1);

	/** @deprecated */
	public static final Integer IS_TONGZHAN_N = new Integer(2);

	/** @deprecated */
	public static final Integer IS_VIEW_Y = new Integer(1);

	/** @deprecated */
	public static final Integer IS_VIEW_N = new Integer(2);
	private String userId;
	private String loginID;
	private String password;
	private String userName;
	private BaseData sexCode;
	private Date birthday;
	private String phone;
	private String mobileTelephone;
	private String email;
	private BaseData folkCode;//民族
//	private BaseData paperTypeCode;	//身份类别
//	private BaseData politicesCode;	//党派
//	private BaseData degreeCode;//学历
	private BaseData dutyLevelCode;//职级
	
	private String dutyLevelId;//职级

	/** @deprecated */
	private String paperNum;

	/** @deprecated */
	private Integer hierarchy;

	private String dutyRemark;

	/** @deprecated */
	private Integer isZugong;

	/** @deprecated */
	private Integer examState;

	/** @deprecated */
	private Integer isBureauReserve;

	/** @deprecated */
	private String currentDutyDate;

	/** @deprecated */
	private Integer isShiguan;
	private Integer activeState;
	private Integer orderNum;

	/** @deprecated */
	private Integer availabilityState;

	/** @deprecated */
	private Date officeHoldingDate;

	/** @deprecated */
	private Integer isDangwu;

	/** @deprecated */
	private Integer isTongzhan;

	/** @deprecated */
	private Integer viewState;

	/** @deprecated */
	private String guid;

	private String remark;

	private Date operateTime;
	
	private BaseData administrativeLevel;

	@Id
	@GenericGenerator(name = "idGenerator", strategy = "assigned")
	@GeneratedValue(generator = "idGenerator")
	public String getUserId() {
		return this.userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	@Column(name = "LOGIN_ID")
	public String getLoginID() {
		return this.loginID;
	}

	public void setLoginID(String loginID) {
		this.loginID = loginID;
	}

	@Column(name = "PASSWORD")
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "USER_NAME")
	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	@ManyToOne(cascade = { javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.REFRESH }, fetch = FetchType.LAZY, optional = true)
	@JoinColumn(name = "SEX_CODE", referencedColumnName = "DATA_CODE")
	public BaseData getSexCode() {
		return this.sexCode;
	}

	public void setSexCode(BaseData sexCode) {
		this.sexCode = sexCode;
	}

	@Column(name = "BIRTHDAY")
	public Date getBirthday() {
		return this.birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	@Column(name = "PHONE")
	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Column(name = "MOBILE_TELEPHONE")
	public String getMobileTelephone() {
		return this.mobileTelephone;
	}

	public void setMobileTelephone(String mobileTelephone) {
		this.mobileTelephone = mobileTelephone;
	}

	@Column(name = "EMAIL")
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	/** @deprecated */
	@Column(name = "PAPER_NUM")
	public String getPaperNum() {
		return this.paperNum;
	}

	/** @deprecated */
	public void setPaperNum(String paperNum) {
		this.paperNum = paperNum;
	}

	/** @deprecated */
	@Column(name = "HIERARCHY")
	public Integer getHierarchy() {
		return this.hierarchy;
	}

	/** @deprecated */
	public void setHierarchy(Integer hierarchy) {
		this.hierarchy = hierarchy;
	}

	@Column(name = "DUTY_REMARK")
	public String getDutyRemark() {
		return this.dutyRemark;
	}

	public void setDutyRemark(String dutyRemark) {
		this.dutyRemark = dutyRemark;
	}

	/** @deprecated */
	@Column(name = "ZUGONG")
	public Integer getIsZugong() {
		return this.isZugong;
	}

	/** @deprecated */
	public void setIsZugong(Integer isZugong) {
		this.isZugong = isZugong;
	}

	/** @deprecated */
	@Column(name = "EXAM_STATE")
	public Integer getExamState() {
		return this.examState;
	}

	/** @deprecated */
	public void setExamState(Integer examState) {
		this.examState = examState;
	}

	/** @deprecated */
	@Column(name = "IS_BUREAU_RESERVE")
	public Integer getIsBureauReserve() {
		return this.isBureauReserve;
	}

	/** @deprecated */
	public void setIsBureauReserve(Integer isBureauReserve) {
		this.isBureauReserve = isBureauReserve;
	}

	/** @deprecated */
	@Column(name = "CURRENT_DUTY_TIME")
	public String getCurrentDutyDate() {
		return this.currentDutyDate;
	}

	/** @deprecated */
	public void setCurrentDutyDate(String currentDutyDate) {
		this.currentDutyDate = currentDutyDate;
	}

	/** @deprecated */
	@Column(name = "SHIGUAN")
	public Integer getIsShiguan() {
		return this.isShiguan;
	}

	/** @deprecated */
	public void setIsShiguan(Integer isShiguan) {
		this.isShiguan = isShiguan;
	}

	@Column(name = "ACTIVE_STATE")
	public Integer getActiveState() {
		return this.activeState;
	}

	public void setActiveState(Integer activeState) {
		this.activeState = activeState;
	}

	@Column(name = "ORDER_NUM")
	public Integer getOrderNum() {
		return this.orderNum;
	}

	public void setOrderNum(Integer orderNum) {
		this.orderNum = orderNum;
	}

	@Column(name = "AVAILABILITY_STATE")
	public Integer getAvailabilityState() {
		return this.availabilityState;
	}

	public void setAvailabilityState(Integer availabilityState) {
		this.availabilityState = availabilityState;
	}

	/** @deprecated */
	@Column(name = "OFFICEHOLDING_DATE")
	public Date getOfficeHoldingDate() {
		return this.officeHoldingDate;
	}

	/** @deprecated */
	public void setOfficeHoldingDate(Date officeHoldingDate) {
		this.officeHoldingDate = officeHoldingDate;
	}

	/** @deprecated */
	@Column(name = "DANGWU")
	public Integer getIsDangwu() {
		return this.isDangwu;
	}

	/** @deprecated */
	public void setIsDangwu(Integer isDangwu) {
		this.isDangwu = isDangwu;
	}

	/** @deprecated */
	@Column(name = "TONGZHAN")
	public Integer getIsTongzhan() {
		return this.isTongzhan;
	}

	/** @deprecated */
	public void setIsTongzhan(Integer isTongzhan) {
		this.isTongzhan = isTongzhan;
	}

	/** @deprecated */
	@Column(name = "VIEW_STATE")
	public Integer getViewState() {
		return this.viewState;
	}

	/** @deprecated */
	public void setViewState(Integer viewState) {
		this.viewState = viewState;
	}

	/** @deprecated */
	@Column(name = "GUID")
	public String getGuid() {
		return this.guid;
	}

	/** @deprecated */
	public void setGuid(String guid) {
		this.guid = guid;
	}

	@Column(name = "REMARK")
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "LAST_OPERATE_TIME")
	@JsonSerialize(using = CustomDateSerializer.class)
	public Date getOperateTime() {
		return this.operateTime;
	}

	public void setOperateTime(Date operateTime) {
		this.operateTime = operateTime;
	}

	@ManyToOne(cascade = { javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.REFRESH }, fetch = FetchType.LAZY, optional = true)
	@JoinColumn(name = "FOLK_CODE", referencedColumnName = "DATA_CODE")
	public BaseData getFolkCode() {
		return folkCode;
	}

	public void setFolkCode(BaseData folkCode) {
		this.folkCode = folkCode;
	}
	
	@ManyToOne(cascade = { javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.REFRESH }, fetch = FetchType.LAZY, optional = true)
	@JoinColumn(name = "ADMINISTRATIVE_LEVEL", referencedColumnName = "DATA_CODE")
	public BaseData getAdministrativeLevel() {
		return administrativeLevel;
	}

	public void setAdministrativeLevel(BaseData administrativeLevel) {
		this.administrativeLevel = administrativeLevel;
	}

	public String toString() {
		return "主键======>" + getUserId() + "\n人员姓名======>" + getUserName() + "\n账号======>" + getLoginID() + "\n电子邮件======>" + getEmail() + "\n手机号码======>" + getMobileTelephone() + "\n证件号码======>" + getPaperNum() + "\n现任职时间======>" + getCurrentDutyDate() + "\n职务======>" + getDutyRemark()
				+ "\n活动状态======>" + getActiveState() + "\n排序编号======>" + getOrderNum() + "\n学员的GUID======>" + getGuid() + "\n密码======>" + getPassword() + "\n电话======>" + getPhone() + "\n报名状态======>" + getAvailabilityState() + "\n考核状态======>" + getExamState() + "\n级别分类======>" + getHierarchy()
				+ "\n是否是局级后备======>" + getIsBureauReserve() + "\n是否是党务干部======>" + getIsDangwu() + "\n是否是市管干部======>" + getIsShiguan() + "\n是否是统战干部======>" + getIsTongzhan() + "\n是否是组工干部======>" + getIsZugong() + "\n显示状态======>" + getViewState() + "\n出生日期======>" + getBirthday() + "\n任职时间======>"
				+ getOfficeHoldingDate() + "\n性别======>" + getSexCode() ;
	}

	@Transient
	public String getID() {
		return this.userId;
	}

	public void setID(String id) {
		this.userId = id;
	}

	@Transient
	public String getName() {
		return this.userName;
	}

	public void setName(String name) {
		this.userName = name;
	}

//	@ManyToOne(cascade = { javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.REFRESH }, fetch = FetchType.LAZY, optional = true)
//	@JoinColumn(name = "paper_type_code", referencedColumnName = "DATA_CODE")
//	public BaseData getPaperTypeCode() {
//		return paperTypeCode;
//	}
//
//	public void setPaperTypeCode(BaseData paperTypeCode) {
//		this.paperTypeCode = paperTypeCode;
//	}
//
//	public BaseData getPoliticesCode() {
//		return politicesCode;
//	}
//
//	public void setPoliticesCode(BaseData politicesCode) {
//		this.politicesCode = politicesCode;
//	}
//
//	@ManyToOne(cascade = { javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.REFRESH }, fetch = FetchType.LAZY, optional = true)
//	@JoinColumn(name = "degree_Code", referencedColumnName = "DATA_CODE")
//	public BaseData getDegreeCode() {
//		return degreeCode;
//	}
//
//	public void setDegreeCode(BaseData degreeCode) {
//		this.degreeCode = degreeCode;
//	}
//
	@ManyToOne(cascade = { javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.REFRESH }, fetch = FetchType.LAZY, optional = true)
	@JoinColumn(name = "duty_Level_Code", referencedColumnName = "DATA_CODE")
	public BaseData getDutyLevelCode() {
		return dutyLevelCode;
	}

	public void setDutyLevelCode(BaseData dutyLevelCode) {
		this.dutyLevelCode = dutyLevelCode;
	}

	@Transient
	public String getDutyLevelId() {
		return dutyLevelId;
	}

	public void setDutyLevelId(String dutyLevelId) {
		this.dutyLevelId = dutyLevelId;
	}
}